﻿Imports System.Object
Imports VSModel
Imports Cls_Common
Partial Class Control_VBPQ_Detail
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If Not Page.RouteData.Values("Id") Is Nothing Then
                hidID.Value = Page.RouteData.Values("Id")
                ShowData()
            End If
        End If
    End Sub
    Protected Sub ShowData()
        Using data As New VSEntities
            'Dim p = (From q In data.VBPQDocument Join a In data.VBPQChucDanhNguoiKy On q.Id Equals a.DocumentId _
            'Where q.Id = hidID.Value Select q).SingleOrDefault
            Dim Id = hidID.Value
            Dim p As IList(Of uspVBPQDetail_Result) = data.uspVBPQDetail(Id).ToList
            If Not p Is Nothing Then
                For i As Integer = 0 To p.Count - 1
                    ltrTitle.Text = IIf(IsNothing(p(i).TrichYeu) = True, "", p(i).TrichYeu)
                    ltrContent.Text = IIf(IsNothing(p(i).NoiDung) = True, "", p(i).NoiDung)
                    ltrCode.Text = IIf(IsNothing(p(i).SoKyHieu) = True, "", p(i).SoKyHieu)
                    ltrType.Text = IIf(IsNothing(p(i).LoaiVanBan) = True, "", p(i).LoaiVanBan)
                    ltrCenterTitle.Text = IIf(IsNothing(p(i).TrichYeu) = True, "", p(i).TrichYeu)
                    ltrOffice.Text = IIf(IsNothing(p(i).ChucDanh) = True, "", p(i).ChucDanh)
                    ltrSigner.Text = IIf(IsNothing(p(i).NguoiKy) = True, "", p(i).NguoiKy)
                    ltrPublishDate.Text = IIf(IsNothing(p(i).NgayBanHanh) = True, "", p(i).NgayBanHanh)
                    ltrCQBH.Text = IIf(IsNothing(p(i).CoQuanBH) = True, "", p(i).CoQuanBH)
                Next
            End If
        End Using
    End Sub
End Class
